package main;
import controller.SimpleController;
import model.SimpleModel;
import user_interface.UserInterface;
import utils.Copy;


public class Main {
	public static void main(String[] args) {
		prepare_env();

		SimpleModel model = new SimpleModel();
		SimpleController controller = new SimpleController(model);
		UserInterface ui = new UserInterface(controller, model);
		controller.setUserInterface(ui);
	}
	
	public static void prepare_env() {
		// copy needed dll
		String osName = System.getProperty("os.name");
		String osArch = System.getProperty("os.arch");
		if(osName.indexOf("Win") >= 0) {
			if(osArch.equals("x86")) {
				try {
					Copy.copy("lib/GLPK/w32/glpk_4_47.dll", "glpk_4_47.dll");
					Copy.copy("lib/GLPK/w32/glpk_4_47_java.dll", "glpk_4_47_java.dll");
				} catch (Exception ex) {}
			} else {
				try {
					Copy.copy("lib/GLPK/w64/glpk_4_47.dll", "glpk_4_47.dll");
					Copy.copy("lib/GLPK/w64/glpk_4_47_java.dll", "glpk_4_47_java.dll");
				} catch (Exception ex) {}				
			}
		}
	}
}

